package com.bt.lms.ui.page.sys.style.action.btn;

import com.bt.lms.ui.page.sys.style.BtnStyle;
import javafx.event.EventHandler;
import javafx.scene.control.Button;
import javafx.scene.input.MouseEvent;
import javafx.scene.paint.Color;

/**
 * 取消按钮的鼠标移入事件
 */
public class CancelBtnMouseAction implements EventHandler<MouseEvent> {

    /**
     * 按钮
     */
    private final Button cancelBtn;

    /**
     * 构建事件
     * @param cancelBtn 取消按钮
     */
    public CancelBtnMouseAction(Button cancelBtn) {
        this.cancelBtn =cancelBtn;
    }

    /**
     * 构建事件
     * @param event the event which occurred
     */
    @Override
    public void handle(MouseEvent event) {

        //渐变背景色
        Color color = Color.rgb(255,255,255);
        Color toColor = Color.rgb(210,210,210);
        BtnStyle.gradualChangeBack(cancelBtn, color, toColor);

        //边框
        Color rgb = Color.rgb(197, 197, 197);
        BtnStyle.btnBorder(cancelBtn,rgb);
    }
}
